using FastNetCore.Core.Enums;

namespace FastNetCore.Core.CustomException;


/// <summary>
/// 业务异常
/// </summary>
public class ServiceException : Exception
{
    public int Code { get; }
    
    public string ErrorMessage { get; }

    public ServiceException(int code, string errorMessage)
        : base(errorMessage)
    {
        Code = code;
        ErrorMessage = errorMessage;
    }

    public ServiceException(AbstractBaseExceptionEnum exceptionEnum)
        :this(exceptionEnum.GetErrorCode(), exceptionEnum.GetErrorMessage())
    {
        
    }
    
}